/**
 * Created by IntelliJ IDEA.
 * User: alexander
 * Date: 13.09.11
 * Time: 12:14
 * To change this template use File | Settings | File Templates.
 */
package com.etc {
import com.framework.math.Amath;

import flash.display.Graphics;

import flash.display.MovieClip;

import flash.display.Sprite;

import spark.primitives.Graphic;

public class DebugCell_mc extends MovieClip {

	private var _cell: Sprite = null;
	private var _borderColor: Number = 0x433A34;

	private var _width: Number = 32;
	private var _height: Number = 32;

	private var _colors: Array = [0xffffff, 0x644931 ,0x352f28, 0x4A3E33, 0xEBEB5B, 0xD1D154 ];

	public function DebugCell_mc( ) {
		super();
		_cell = getCell( 0xffffff );
		addChild(_cell);
	}

//		public static const STATE_CELL_FREE:int = 1;
//		public static const STATE_CELL_BUSY:int = 2;
//		public static const STATE_CELL_BUILD_ONLY:int = 3;
//		public static const STATE_CELL_START:int = 4;
//		public static const STATE_CELL_FINISH:int = 5;

	override public function gotoAndStop(frame:Object, scene:String = null):void {
		removeChild(_cell);
		var st:Number = frame as Number;
		_cell = getCell( _colors[st] );
		addChild(_cell);
	}

	protected function getCell( color: Number ): Sprite {
		var w: Number = _width, h: Number = _height;
		var cell:Sprite = Utils.rect(w,h,color);
		var g: Graphics = cell.graphics;
		g.moveTo(-w/2,-h/2);
		g.lineStyle(1,_borderColor);
		g.lineTo(-w/2,h/2);
		g.moveTo(-w/2,-h/2);
		g.lineTo(w/2,-h/2);
		g.endFill();
		return cell;
	}
}
}
